unit ConfiguraCodigoBarras;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, Buttons;

type
  TFormConfiguraCodigoBarras = class(TForm)
    Label1: TLabel;
    MaskEdit1: TMaskEdit;
    GroupBox1: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    GroupBox2: TGroupBox;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    RadioButton6: TRadioButton;
    RadioButton7: TRadioButton;
    GroupBox3: TGroupBox;
    RadioButton8: TRadioButton;
    RadioButton9: TRadioButton;
    MaskEdit2: TMaskEdit;
    Label2: TLabel;
    BitBtn1: TBitBtn;
    procedure MaskEdit1Exit(Sender: TObject);
    procedure MaskEdit2Exit(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormConfiguraCodigoBarras: TFormConfiguraCodigoBarras;

implementation

uses principal, declaracoes, funcoesapoio;

{$R *.dfm}

procedure TFormConfiguraCodigoBarras.MaskEdit1Exit(Sender: TObject);
begin
        if (StrToInt(Maskedit1.Text)<1) or (StrToInt(Maskedit1.Text)>255) then MaskEdit1.Setfocus;
end;

procedure TFormConfiguraCodigoBarras.MaskEdit2Exit(Sender: TObject);
begin
        if (StrToInt(Maskedit2.Text)<0) or (StrToInt(Maskedit1.Text)>575) then MaskEdit1.Setfocus;

end;

procedure TFormConfiguraCodigoBarras.BitBtn1Click(Sender: TObject);
var largura, posicao, fonte:String;
begin
        if RadioButton1.Checked then largura:='0'
        else if RadioButton2.Checked then largura:='1'
        else if  RadioButton3.Checked then largura:='2';

        if RadioButton4.Checked then posicao:='0'
        else if RadioButton5.Checked then posicao:='1'
        else if  RadioButton6.Checked then posicao:='2'
        else if  RadioButton7.Checked then posicao:='3';

        if RadioButton8.Checked then fonte:='0'
        else if RadioButton9.Checked then fonte:='1';

        FormPrincipal.Statusbar1.Panels[0].Text:='Configura Código de Barras MFD'; WaitProcess;
        Resposta:= ECF_ConfiguraCodigoBarrasMFD( MaskEdit1.Text, largura, posicao, fonte, MaskEdit2.Text);

        FormPrincipal.Memo1.Lines.Add('Configura Código de Barras MFD:'+inttostr(Resposta));
        FormPrincipal.Memo1.Lines.Add('');

        VerificaRetornoFuncao(Resposta);
        Refresh;

end;

end.
